<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background: url(./背景图片/1.jpg) no-repeat top  center/cover;
        }
    </style>
<body>
    <script>
        // 1.获取N~M的随机整数
        function getrandom(N,M) {
            return Math.floor(Math.random()*(M-N+1))+N
        }
        const random=getrandom(1,4)
        document.body.style.backgroundImage=`url(./背景图片/${random}.jpg)`
    </script>
</body>
</html>